package com.hhp.cloud.shop.admin.service.impl;

import cn.hutool.core.collection.CollectionUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.hhp.cloud.shop.admin.dao.OauthClientDao;
import com.hhp.cloud.shop.admin.pojo.entity.OauthClientEntity;
import com.hhp.cloud.shop.admin.service.OauthClientService;

import java.util.Set;


@Service("oauthClientService")
@RequiredArgsConstructor
public class OauthClientServiceImpl extends ServiceImpl<OauthClientDao, OauthClientEntity> implements OauthClientService {

    private final StringRedisTemplate stringRedisTemplate;

    /**
     * @Description: 清理客户端缓存
     * @author: hhp
     * @Param:
     * @return: * @return
     * @date 2021/11/30 10:24
     */
    @Override
    public void cleanCache() {
        Set<String> keys = stringRedisTemplate.keys("auth:oauth-client:*");
        if (CollectionUtil.isNotEmpty(keys)) {
            stringRedisTemplate.delete(keys);
        }
    }
}